//
//  MacroDefine.swift
//  ttjx
//
//  Created by 文 on 2019/8/28.
//  Copyright © 2019 ttjx. All rights reserved.
//

import Foundation
import UIKit

let whIdentity      = "access_identity"
let whTokenHead      = "access_token_head"
let whToken      = "access_token"
let Authorization  = "netAuthorization"

let left_menu_width = kFitWidth(300)

/********页面属性************/
//MARK: -全局尺寸
let SCREEN_WIDHT     = UIScreen.main.bounds.width //屏幕宽度
let SCREEN_HEIGHT    = UIScreen.main.bounds.height //屏幕高度

let Scale_Width      = (UIScreen.main.bounds.width/750)
let Scale_Height     = (UIScreen.main.bounds.height/1334)

//适配iPhoneX
//获取状态栏的高度，全面屏手机的状态栏高度为44pt，非全面屏手机的状态栏高度为20pt
//状态栏高度
let statusBarHeight = UIApplication.shared.statusBarFrame.height;

//快拼拼
//let APPID_WX        = "wx38d12c2c19cf491a"
//let APP_SECRET      = "ef906a1bf6fa7312717ca16c49708604"
//快季
let APPID_WX        = "wxa141f5793a88da3a"
let APP_SECRET      = "001d6c393caaddfb66c71c0b581eec6d"

//let ALI_LOGIN_SECRET = "x5h/7PjZIRIEnwqaix4PpY3Yiv0iXqUFdRTlJQXwM8hjJu8GM1ohkHmRO9/HNDqr3MPzmgE+wowuJCY7ZbVLiwTEs+lmHJTTPnazQxXyvXcVSQC6f0RJWzEK7QlBvfhLXVRbqCq/+CRDXY6km9qGpqFSGuZBnG5HYSWZfRXlUJzbqjGKgLn7iajjLnSJDAaMFTjKcMhPKbu2GeDV1CAdskj0n9tcEvJayoz3MlSxuTSmR23PRLO+KQEGKCNx5RB0LaBD8TazmyU="

let ALI_LOGIN_SECRET = "1AmKOcyo6rCUUpzuk+Chqp9Mhqn5BHhTBtySlphXBA5e55uEfonISVAy5vNyGI6dHkrw6wHvh+qs5ol3sUorzPQfxeedGPjJ4VNGepCtOcu9uqtBFVhAUqq7zLxVcs1zDcMKAYubVTZ9qfeOMZ1fkbdq1c7qCQT5RD7y5RYnjID94B5LYGdy1yRcG3rVTOC3l9gARvjDgQjem9ILfyasUXmhUxNYJz1bUzBTFSr9INeyduUW/7ypFtjcrBUf4qK80NZiQH0PeWk="

let LOGIN_NOTIFICATION_NAME = "userIsLogin"

///生成渐变颜色图片
func getGradientImage(size:CGSize) -> UIImage{
    UIGraphicsBeginImageContextWithOptions(size, false, UIScreen.main.scale)
    guard let context = UIGraphicsGetCurrentContext() else{return UIImage()}
    let colorSpace = CGColorSpaceCreateDeviceRGB()
    ///设置渐变颜色
    let gradientRef = CGGradient(colorsSpace: colorSpace, colors: [WHColorWithAlpha(colorStr: "FF8282", alpha: 1).cgColor,WHColor_16(colorStr: "F10E0E").cgColor] as CFArray, locations: nil)!
    let startPoint = CGPoint(x: 0, y: size.height/2)
    let endPoint = CGPoint(x: size.width, y: size.height/2)
//    let startPoint = CGPoint(x: size.width / 2, y: 0)
//    let endPoint = CGPoint(x: size.width / 2, y: size.height)
    context.drawLinearGradient(gradientRef, start: startPoint, end: endPoint, options: CGGradientDrawingOptions(arrayLiteral: .drawsBeforeStartLocation,.drawsAfterEndLocation))
    let gradientImage = UIGraphicsGetImageFromCurrentImageContext()
    UIGraphicsEndImageContext()
    return gradientImage ?? UIImage()
}
